package com.hq.ims.platform.controller;

import com.hq.ims.data.service.BasePlatformTodoStatisticsService;
import com.hq.ims.data.utils.LocalConstant;
import com.hq.ims.data.vo.PlatformTodoStatisticsMapstruct;
import com.hq.utils.vo.ReturnVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "待办")
@RestController
@RequestMapping(LocalConstant.SYS_TYPE_PLATFORM_URL_PREFIX + "/todo")
public class PlatformTodoController {

    @Resource
    private BasePlatformTodoStatisticsService basePlatformTodoStatisticsService;

    @ApiOperation(value = "清除待办", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
    })
    @PostMapping(value = "/clearTodo", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<Boolean> clearTodo(
            @RequestBody PlatformTodoStatisticsMapstruct.ClearTodo clearTodo
    ) {
        switch (clearTodo.getPlatformTodoType()) {
            case CompanyWaitAuditCount:
            case BusinfoWaitAuditCount:
//            case DivideIntoWaitAuditCount:
                break;
            case BusinfoFeedbackNotifyCount:
                basePlatformTodoStatisticsService.clearTodo(clearTodo);
                break;
            default:
                break;
        }
        return ReturnVo.buildSuccess(true);
    }

    @ApiOperation(value = "获取待办数量", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
    })
    @PostMapping(value = "/getMyTodo", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<List<PlatformTodoStatisticsMapstruct.PlatformTodoStatisticsVo>> getMyTodo(

    ) {
        List<PlatformTodoStatisticsMapstruct.PlatformTodoStatisticsVo> voList = basePlatformTodoStatisticsService.getList();
        return ReturnVo.buildSuccess(voList);
    }

}
